N_original = 0

# Assume everyone chooses to hunt or slack randomly with probability of hunting
# given by their reputation.  From that compute an estimate for how much food
# they have remaining.  The estimates may get a bit off if players start to run
# out of food.
#
# From the estimates we just cooperate with those who are doing the worst and
# antagonize those who are doing well.
#
# Side note: this has barely been tested.

def hunt_choices(round_number, current_food, current_reputation, m, 
                 player_reputations):
    global N_original

    N = len(player_reputations) + 1
    if N_original == 0:
      N_original = N

    if N == 2:
      return ['s']
    
    h_sum = current_reputation + sum(player_reputations)
    food_estimate = [300 * (N_original - 1) - round_number *
                     (3 * (h_sum - h_player) - (N - 1) * (2 + h_player))
                      for h_player in player_reputations]

    discriminant = sorted(food_estimate)[(N - 1) * 35 / 100]

    hunt_decisions = [('h' if food_player < discriminant + 1e-9 else 's')
                      for food_player in food_estimate]
    return hunt_decisions

def hunt_outcomes(food_earnings):
    pass

def round_end(award, m, number_hunters):
    pass
